package com.neusoft.my12306.common.res;

public class CommonResult<T> implements IResult {

    private Integer code = 200;
    private String msg = "OK";
    private T data;

    public CommonResult() {

    }

    public CommonResult(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public CommonResult(T data) {
        this.code = 200;
        this.msg = "OK";
        this.data = data;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }

    public T getData() {
        return this.data;
    }

    public void setNotFound() {

        this.code = NOTFOUND;
        this.msg = "请求的资源不存在";
    }

    public void setNotModified() {
        this.code = 203;
        this.msg = "未修改。所请求的资源未被修改";
    }
}
